<script>
import { requestGet } from '@/api/system/common'

export default {
  name: 'RedirectCode',
  created() {
    this.init()
  },
  methods: {
    init() {
      this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      })
      const code = this.$route.query.code
      if (undefined !== code && code !== null && code !== '') {
        requestGet('rest/api/url/v1/redirect/code', { code: code })
          .then(res => {
            const { data } = res
            window.location.href = data
          }).catch(() => {
            window.location.href = '/404'
          })
      } else {
        window.location.href = '/404'
      }
    }
  }
}
</script>

<template>
  <div>1
    <a target="_self" />
  </div>
</template>

<style lang="scss" scoped>

</style>
